<template>
	<div class="siteerweima">
		<div v-loading="loading" class="go" @click="go"><el-button type="primary" size="small">前往下单</el-button></div>
	</div>
</template>

<script>
	import axios from 'axios'
	
	export default{
		
		name: 'siteerweima',
		data(){
			return{
				id:"",
				name:"",
				link:"",
				loading:true
			}
		},
		created() {
			axios.get('/api/plan-market/media/product/info?media_id='+this.$route.query.media_id+'&id='+this.$route.query.id)
				.then(response => {
					if(response.data.msg.code == 0){
						this.id = response.data.data.good_id
						// location.href = window.location.origin+"/webapp/merchant/templet1.html?share_id="+this.$route.query.share_id+"&id="+this.id
						// window.open(window.location.origin+"/webapp/merchant/templet1.html?share_id="+this.$route.query.share_id+"&id="+this.id)
						// window.location.href = window.location.origin+"/webapp/merchant/templet1.html?share_id="+this.$route.query.share_id+"&id="+this.id
						this.link = window.location.origin+"/webapp/merchant/templet1.html?share_id="+this.$route.query.share_id+"&id="+this.id
						this.loading = false
					}else{
						if(response.data.msg.code == 50401){that.$router.push({ path: "/login" }); return false}
						that.$message.error(response.data.msg.info);
					}
				})

			
			// location.href = window.location.origin+"/webapp/merchant/templet1.html?share_id="+this.$route.query.share_id+"&id="+this.id
		},
		methods:{
           go:function(){
			  
			   window.location.href = this.link
		   }
		}
	}
</script>

<style lang="scss" >
	.siteerweima{margin: 0; padding: 0; background: #ffffff;
		.go{ display: flex; justify-content: center; align-items: center;  height: 667px;
			button{  cursor: pointer;}
		}
	}
</style>
